/* eslint-disable @typescript-eslint/no-explicit-any */
import { Tree } from "antd";
import { useComponetsStore } from "../../../store/components";

export function Outline() {//左侧大纲（组件树）
    const { components, setCurComponentId } = useComponetsStore();

    return <Tree
        fieldNames={{ title: 'desc', key: 'id' }}
        treeData={components as any}
        showLine
        defaultExpandAll
        onSelect={([selectedKey]) => {
            setCurComponentId(selectedKey as number);//选中的时候切换curComponentId
        }}
    />
}
